#!/bin/sh

str1="str1"
str2="str2"

str3="a"${str1}${str2}
echo ${str3}

echo "字符串比较"
if [[ $str1 < $str2 ]]; then
	echo "$str1 < $str2"
else
	echo "$str1 >= $str2"
fi

strStar="*"
echo $strStar

if [[ $strStar == "*" ]]; then
	echo "star \*"
else
	echo "no star"
fi


prop_line="@property (nonatomic, copy) NSString* gender;///<我是注释 注释"
asterisk_seperator_pattern="\*"
# 从左向右截取最后一个string后的字符串
prop_name=${prop_line##*${asterisk_seperator_pattern}}
echo "prop_name=${prop_name}"
seal_pattern=";*"
seal_pattern_replacement=""
prop_name=${prop_name//${seal_pattern}/${seal_pattern_replacement}}
echo "prop_name=${prop_name}"


# 判断字符串中时候有包含子字符串
str="XYZSSCatchCouponSampler+ShowABC.h"
str="XYZSSCatchCouponSamplerShowABC.h"
substring="\+"
if [[ ${str} =~ ${substring} ]]; then
	echo "${str} 和 ${substring} 有交集"
else
	echo "${str} 和 ${substring} 没有交集"
fi

isContainString(){
	str=$1
	substring=$2
	if [[ ${str} =~ ${substring} ]]; then
		echo 1
	else
		echo 0
	fi
}

result=$(isContainString ${str} ${substring})
if [[ result -gt 0 ]]; then
	echo "contain"
else
	echo "not contain"
fi
echo "result=${result}"

